Bài 1

HTML Basic

HTML Elements

The HTML elementis everything from the start tag to the end tag:

<tagname> Content goes here...<tagname>/
Start Tag Element content End tag
h1 My first heading /h1
p My first paragraph /p
br none none

HTML Attributes

1. Absolute URL-Links to an external image that is hosted on another website. Example: src="https://www.w3schools.com/images/img_girl.jpg".

Notes:External images might be under copyright. If you do not get permission to use it, you may be in violation of copyright laws. In addition, you cannot control external images; it can suddenly be removed or changed.

2. Relative URL Links to an image that is hosted within the website. Here, the URL does not include the domain name. If the URL begins without a slash, it will be relative to the current page. Example: src="img_girl.jpg". If the URL begins with a slash, it will be relative to the domain. Example: src="/images/img_girl.jpg".

Tip:It is almost always best to use relative URLs. They will not break if you change domain.

HTML Headings

HTML Parahraphs

The HTML <p> element defines a paragraph. A paragraph always starts on a new line, and browsers automatically add some white space (a margin) before and after a paragraph.

HTML Style

The HTML <style> ttribute is used to add styles to an element, such as color, font, size, and more.

HTML Formatting Elements

HTML Quotation

HTML <bdo> for Bi-Directional Override

HTML <!--Comments-->

HTML comments are not displayed in the browser, but they can help document your HTML source code.

    3 types of HTML Comments
  1. <!--single-line comments-->
  2. <!--

    multi-line

    comments

    -->

  3. <!--[if IE]>

    <p>Conditional Comments, this is only displayed in Internet Explorer </p>

    <![endif]-->

HTML Color

HTML colors are specified with predefined color names, or with RGB, HEX, HSL, RGBA, or HSLA values.

Format inline: <[Tag] Style=" char-color: your-color; [other-attribute];">...

HTML Links

HTML Links are hyperlinks
You can click on a link and jump to another document.
When you move the mouse over a link, the mouse arrow will turn into a little hand.
Format: <a href="URL" target="your Attribute">your tittles</a>
You can use or don't use target

ImgHTML

Images can improve the design and the appearance of a web page.

Insert img syntax: <img src="img-url" alt="text">

The HTML <img> tag is used to embed an image in a web page.

Image Size - Width and Height

imgage

<width> and <height> can be use as attributes

<img src="https://biz.prlog.org/oneimageinc/logo.jpg" alt="imgage" width="250";height="250";>

Or you can use the <style> attribute to specify the width and height of an image.

<img src="https://biz.prlog.org/oneimageinc/logo.jpg" alt="imgage" style="width:250px;height:250px;">

Images in Another Folder

If you have your images in a sub-folder, you must include the folder name in the src attribute:

Ex: <img src="/picture/images.png" alt="bruh" style="width:128px;height:128px;">

To point to an image on another server, you must specify an absolute (full) URL in the src attribute:

Ex: <img src="https://biz.prlog.org/oneimageinc/logo.jpg" alt="img">

HTML allows animated GIFs:

Use syntax: <img src="img-name.gif">

Image as a Link

To use an image as a link, put the <img> tag inside the <a> tag:

Image floating

Use the CSS float property to let the image float to the right or to the left of a text

SuccroseEx: <img src="https://th.bing.com/th/id/OIP.qkFfVPRGs3lHfF2gNZzUcAHaHa?rs=1&pid=ImgDetMain" alt="Succrose" style="float:inline-start;width:60px;height:auto;">

The image will float to the left-inline of the text

Common Image Formats

Abbreviation File Formatt File Extension
APNG Animated Portable Network Graphics .apng
GIF Graphics Interchange Format .gif
ICO Microsoft Icon .ico, .cur
JPEG Joint Photographic Expert Group image .jpg, .jpeg, .jfif, .pjpeg, .pjp
PNG Portable Network Graphics .png
SVG Scalable Vector Graphics .svg

HTML Image Tags

>
Tag Description
<img> Defines an image
<map> Defines an image map
<area> Defines a clickable area inside an image map
<picture> Defines a container for multiple image resources

To add a background image on an HTML element, use the HTML style attribute and the CSS background-image property:

Add a background image on a HTML element:

<p style="background-image: url('img-url');">

You can also specify the background image in the <style> element, in the <head> section

If the background image is smaller than the element, the image will repeat itself, horizontally and vertically, until it reaches the end of the element

To avoid the background image from repeating itself, set the background-repeat property to no-repeat.

If you want the background image to cover the entire element, you can set the background-size property to cover.

Also, to make sure the entire element is always covered, set the background-attachment property to fixed

If you want the background image to stretch to fit the entire element, you can set the background-size property to 100% 100%

HTML <picture> Element

The HTML <picture> element allows you to display different pictures for different devices or screen sizes.

HTML Tables

Each table cell is defined by a <td> and a </td> tag. and stand for table data

Ex: <td>cell-data</td>

Each table row starts with a <tr> and ends with a </tr> tag.

Ex:

<tr>

<td>cell-data</td>

</tr>

Table header

replace <td> by <th>

an example:

Header 1 Header 2
<cell 1> cell 2

HTML Lists

Unordered HTML List

An unordered list starts with the <ul> tag. Each list item starts with the <li> tag. The list items will be marked with bullets (small black circles) by default:

Ex:

<ul> unordered list

<li>item-1</li>

<li>item-2</li>

</ul>

and this is result:

Ordered HTML List

An ordered list starts with the </ol> tag. Each list item starts with the <li> tag. The list items will be marked with numbers by default:

Ex:

<ol> ordered list

<li>item-1</li>

<li>item-2</li>

</ol>

and this is result:

    ordered
  1. item-1
  2. itwm-2

HTML Description Lists

The <dl> tag defines the description list, the <dt> tag defines the term (name), and the <dd> tag describes each term

Ex:

<dl> Description list

<dt>term-1</dt>

<dd>- item-1</dd>

<dt>term-2</dt>

<dd>- item-2</dd>

</dl>

and this is result:

Description list
term-1
- item-1
term-2
- item-2

HTML List Tags

>
Tag Description
<ul> Defines an unordered list
<ol> Defines an ordered list
<li> Defines a list item
<dl> Defines a description list
<dt> Defines a term in a description list
<dd> Describes the term in a description list

HTML Block and Inline Elements